/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author Andy
 */
@Entity(name = "Inventory")
public class InventoryEntity extends DataObjectEntity implements Serializable {

    @OneToOne
    private BatchEntity batch;
    private int currentQuantity;
    @OneToMany(mappedBy="inventory", cascade=CascadeType.ALL)
    private Collection<LocationQuantityEntity> locationToQuantity = new ArrayList<LocationQuantityEntity>();

    public InventoryEntity() {
        super();
        this.setArchived(false);
    }

    public BatchEntity getBatch() {
        return batch;
    }

    public void setBatch(BatchEntity batch) {
        this.batch = batch;
    }

    public int getCurrentQuantity() {
        return currentQuantity;
    }

    public void setCurrentQuantity(int currentQuantity) {
        this.currentQuantity = currentQuantity;
    }

    public Collection<LocationQuantityEntity> getLocationToQuantity() {
        return locationToQuantity;
    }

    public void setLocationToQuantity(Collection<LocationQuantityEntity> locationToQuantity) {
        this.locationToQuantity = locationToQuantity;
    }

    @Override
    public String childToString() {
        return "InventoryEntity{" + "batch=" + batch + ", currentQuantity=" + currentQuantity + ", locationToQuantity=" + locationToQuantity + '}';
    }
    
}
